import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PaymentVO, PaymentForm, PaymentQuery } from '@/api/cemetery/payment/types';

/**
 * 查询支付列表
 * @param query
 * @returns {*}
 */

export const listPayment = (query?: PaymentQuery): AxiosPromise<PaymentVO[]> => {
  return request({
    url: '/cemetery/payment/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询支付详细
 * @param id
 */
export const getPayment = (id: string | number): AxiosPromise<PaymentVO> => {
  return request({
    url: '/cemetery/payment/' + id,
    method: 'get'
  });
};

/**
 * 新增支付
 * @param data
 */
export const addPayment = (data: PaymentForm) => {
  return request({
    url: '/cemetery/payment',
    method: 'post',
    data: data
  });
};

/**
 * 修改支付
 * @param data
 */
export const updatePayment = (data: PaymentForm) => {
  return request({
    url: '/cemetery/payment',
    method: 'put',
    data: data
  });
};

/**
 * 删除支付
 * @param id
 */
export const delPayment = (id: string | number | Array<string | number>) => {
  return request({
    url: '/cemetery/payment/' + id,
    method: 'delete'
  });
};
